package com.github.wxiaoqi.security.auth.config;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import cn.hutool.setting.Setting;
import lombok.Getter;

@Component
public class ClientInfoProperties {
	@Value("config/clientinfo-${spring.profiles.active}.setting")
	private String env;
	
	@Getter
    private String id;
	
	@Getter
    private String secret;
	
	@Getter
    private String tokenHeader;
	
	@Getter
	private long expire;
	
	@Getter
	private String rsaSecret;
    
    @PostConstruct
    private void init() {
    	Setting s = new Setting(env,true);
    	id = s.getStr("id");
    	secret = s.getStr("secret");
    	tokenHeader = s.getStr("token-header");
    	expire = s.getLong("expire");
    	rsaSecret = s.getStr("rsa-secret");
    }
	
}
